﻿<?php
	include 'conexao.php';
	session_start();
	
	$senha   = $_REQUEST['senha'];
	$senhan  = $_REQUEST['senhan'];
	$senhanc = $_REQUEST['senhanc'];
	
	if($senhan == $senhanc){
	
		$update = "UPDATE usuario SET senha='".$senhan."' WHERE senha='".$senha."' AND id='".$_SESSION['valida']."';";
		
		if(mysql_query($update)){
			header ("location:../chat.php");
			$_SESSION['update'] = '1';
		}else{
			header ("location:../chat.php");
			$_SESSION['update'] = '2';
		}
	}else{
		header ("location:../chat.php");
		$_SESSION['update'] = '2';
	}
?>